#include<bits/stdc++.h>
using namespace std;

struct Node{
    int element;
    Node *next;
};


Node *head = new Node;

void insert(int element){
    Node *p = head;
    while(p->next!=NULL && p->next->element < element){
        p = p->next;
    }
    //插入
    Node *newNode = new Node;
    newNode->element = element;
    newNode->next = p->next;
    p->next = newNode;
}

void print_all(){
    Node *p = head->next;
    while(p!=NULL){
        cout<<p->element<<' ';
        p = p->next;
    }
}

void delete_all(){
    Node *p = head;
    while(p!=NULL){
        Node *delete_ptr = p;
        p = p->next;
        delete delete_ptr;
    }
}

int main(){
    int n;
    cin>>n;
    Node *head = new Node;  head->next = NULL;
    Node *rear = head;
    for(int i=0; i<n; ++i){
        int a;
        cin>> a;
        insert(a);
    }
    print_all();
    delete_all();
    return 0;
}